home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Imaging / PolygonClipper / PGEdge.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  2.3 KB  |  87 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        PGEdge.h
  3.  
  4.     Contains:    Active-edge structure for the clipper.
  5.  
  6.     Owned by:    Jens Alfke (based on algorithm by A. C. Kilgour)
  7.  
  8.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.     
  12.          <2>     5/25/95    jpa        List.h --> LinkList.h [1253324]
  13.          <1>     6/15/94    jpa        first checked in
  14.          ---------------------------Moved to ODSOM project.
  15.          <1>      5/9/94    jpa        first checked in
  16.  
  17.     Theory of Operation:
  18.     In Progress:
  19. */
  20.  
  21. #ifndef _PGEDGE_
  22. #define _PGEDGE_
  23.  
  24. #ifndef _ODTYPES_
  25. #include "ODTypes.h"
  26. #endif
  27.  
  28. #ifndef _LINKLIST_
  29. #include "LinkList.h"
  30. #endif
  31.  
  32. #ifndef _PGCOMMON_
  33. #include "PGCommon.h"
  34. #endif
  35.  
  36.  
  37. class PGVertex;
  38. class PGOutputContour;
  39.  
  40.  
  41. // PGEdge represents an edge in the Active Edge Table.
  42. class PGEdge :public Link
  43. {
  44.     public:
  45.         PGEdge( const PGVertex *tail, const PGVertex *head );
  46.  
  47.         PGSide        TestPoint( const ODPoint& );    // Which side of line is pt on?
  48.         ODBoolean    IntersectWith( const PGEdge*, ODPoint § );
  49.         PGEdge*        ReplaceWithCopy( );                // Returns the copy
  50.                 
  51.         void        StartPath( PGEdge *rightEdge, const ODPoint* );
  52.         void        ExtendPath( PGEdge *lowerEdge, const ODPoint* );
  53.         void        MergePaths( PGEdge*, const ODPoint* );
  54.         
  55.         ODSShort            fWrapNo;                // Wrap-number of my contour
  56.         PGSense        const    fSense;                    // kPositive if heading downward
  57.         ODBoolean            fLowEvent;                // Has bottom been entered into event queue?
  58.         ODBoolean            fMatched;                // Temp flag used in edge-matching
  59.         ODBoolean            fLeftBundle,            // Bundled w/prev edge?
  60.                             fRightBundle;            // Bundled w/next edge?
  61.         const PGVertex        *fHighVert,                // Top (min. y) vertex
  62.                             *fLowVert;                // Bottom (max. y) vertex
  63.         ODPoint                fDelta;                    // Dist from high to low vert. y >= 0!
  64.  
  65.         PGSide                fSide;                    // Which side of output path?
  66.         PGEdge                   *fOtherSide;            // Edge on other side of output contour
  67.         PGOutputContour        *fOutput;                // Output contour
  68. };
  69.  
  70.  
  71. class PGEdgeTable :public LinkedList
  72. {
  73.     public:
  74.         void    Add( PGEdge* );                        // Adds sorted
  75.         
  76.         void    InsertListBefore( PGEdgeTable&, PGEdge *before );
  77.         void    AddRange( PGEdge *first, PGEdge *last, PGEdge *before );
  78.         PGEdge*    RemoveRange( PGEdge *first, PGEdge *last );
  79.         
  80.         void    Unmatch( );
  81.         PGEdge*    FirstUnmatched( );
  82.         PGEdge*    LastUnmatched( );
  83.         PGEdge*    UnmatchedBefore( const PGEdge* );
  84.         PGEdge*    UnmatchedAfter( const PGEdge* );
  85. };
  86.  
  87. #endif /*_PGEDGE_*/